home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_rockflood.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  311 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pru_rockflood.cog
  4. #
  5. # Push a rock 3DO to flood the "bottomless" pit.
  6. #
  7. # [GGJ]
  8. #
  9. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  10. # ============================================================================
  11. symbols
  12.  
  13. message    startup
  14. message    arrived
  15. message    entered
  16. message    exited
  17.  
  18. cog            hint
  19.  
  20. thing        rock
  21. thing        ghostpoint        nolink        #ghost 'cause water's too big
  22. thing        camera0            nolink
  23. thing        target0
  24. thing        rotateThing0    nolink
  25. thing        splashGhost0    nolink
  26. thing        watersurface
  27. thing        splash0            local
  28. thing        splash1            local
  29. thing        bigX            nolink
  30. thing        root            nolink
  31. thing        player            local
  32. thing        sender            local
  33. thing        source            local
  34.  
  35. sector        teeter            mask=0x480
  36. sector        teeter2            nolink
  37.  
  38. sector        watersector0    mask=0x100
  39. sector        watersector1    mask=0x100
  40. sector        watersector2    mask=0x100
  41. sector        watersector3    mask=0x100
  42. sector        watersector4    mask=0x100
  43. sector        watersector5    mask=0x100
  44. sector        watersector6    mask=0x100
  45. sector        watersector7    mask=0x100
  46.  
  47. sector        othersector0    nolink
  48. sector        othersector1    nolink
  49. sector        othersector2    nolink
  50. sector        crack            nolink
  51. sector        treasuresector    nolink
  52.  
  53. surface        top0            nolink
  54. surface        top1            nolink
  55. surface        bottomsurface0    nolink
  56. surface        bottomsurface1    nolink
  57. surface        bottomsurface2    nolink
  58. surface        bottomsurface3    nolink
  59.  
  60. surface        whirlsurf0        nolink
  61. surface        whirlsurf1        nolink
  62. surface        whirlsurf2        nolink
  63. surface        whirlsurf3        nolink
  64. surface        whirlsurf4        nolink
  65. surface        whirlsurf5        nolink
  66. surface        whirlsurf6        nolink
  67. surface        whirlsurf7        nolink
  68. surface        whirlsurf8        nolink
  69. surface        whirlsurf9        nolink
  70. surface        whirlsurf10        nolink
  71. surface        whirlsurf11        nolink
  72. surface        whirlsurf12        nolink
  73. surface        whirlsurf13        nolink
  74. surface        whirlsurf14        nolink
  75. surface        whirlsurf15        nolink
  76. surface        whirlsurf16        nolink
  77. surface        whirlsurf17        nolink
  78. surface        whirlsurf18        nolink
  79. surface        whirlsurf19        nolink
  80. surface        whirlsurf20        nolink
  81. surface        whirlsurf21        nolink
  82. surface        whirlsurf22        nolink
  83. surface        whirlsurf23        nolink
  84. surface        whirlsurf24        nolink
  85. surface        whirlsurf25        nolink
  86.  
  87. surface        moveSurf 
  88. surface        bldrPlatform    nolink
  89. surface        readytoPush
  90.  
  91. int            curCam            local
  92. int            index=0            local
  93. int            surfIndex=0        local
  94. int            numSurfs=26        local
  95. int            rise0            local
  96. int            rise1            local
  97.  
  98. vector        veclight        local
  99.  
  100. material    splashmat=gen_a4sfx_splash.MAT        local
  101. material    spraymat=gen_a4sprite_wfspray.mat    local
  102.  
  103. template    splashTpl=splshblck                    local
  104. template    splashSprTpl0=bigrocksplash            local
  105.  
  106. sound        gurgle=gen_underwater_a.wav            local
  107. sound        splashSnd=lag_torp_splash_c.wav        local
  108. sound        risingSnd0=nub_bull_move2_c.wav        local
  109. sound        risingSnd1=nub_bull_move1_c.wav        local
  110. sound        streamSnd=olv_stream_a.wav            local
  111. sound        floodMus=mus_lag_swimship.wav        local
  112.  
  113. end
  114.  
  115. # ============================================================================
  116. code
  117. startup:
  118.  
  119. player = GetLocalPlayerThing();
  120. veclight = VectorSet(0, 0.2, 0.8);
  121.  
  122. #turn "off" the surface of the water at the top of the pit
  123. SetFaceGeoMode(top0,0);
  124. SetFaceGeoMode(top1,0);
  125.  
  126. ThingFadeAnim(watersurface, 1, 0, 1, 0);
  127. AttachThingToThing(bigX, rock);
  128.  
  129. SetCollideType(watersurface, 0);
  130.  
  131. return;
  132.  
  133. #............................................................................
  134. arrived:
  135.  
  136. sender = GetSenderRef();
  137.  
  138. if (sender == rock)
  139. {
  140.     if (GetCurFrame(rock) != 2) return;
  141.  
  142.     #Rock blocks opening, water begins to flood the pit.
  143.     Sleep(0.5);
  144.     #Print("block arrived at frame 2");
  145.     ThingFadeAnim(watersurface, 0, 1, 1, 0);
  146.     #Print("making watersurface visible");
  147.  
  148.     AttachThingToThing(ghostpoint, watersurface);
  149.     MoveToFrame(watersurface, 1, 1.5);
  150.     #Print("moving watersurface");
  151.  
  152.     rise0=PlaySoundThing(risingSnd0, watersurface, 1, -1,-1, 1);
  153.     #Print("Playing sound on watersurface");
  154.  
  155.     #"Water surface" at lower stream is turned off
  156.     SetFaceGeoMode(bottomsurface0, 0);
  157.     SetFaceGeoMode(bottomsurface1, 0);
  158.     SetFaceGeoMode(bottomsurface2, 0);
  159.     SetFaceGeoMode(bottomsurface3, 0);
  160.  
  161.     for (surfIndex = 0; surfIndex < numSurfs; surfIndex = surfIndex + 1)
  162.     {
  163.         SetFaceGeoMode(whirlSurf0[surfIndex], 0);
  164.     }
  165.     #Print("turning off water adjoins at bottom");
  166. }
  167. else if (sender == watersurface)
  168. {
  169.     if (GetCurFrame(watersurface) == 2)
  170.     {
  171.         #"Water surface" at top of pit is turned on, rising water 3do is destroyed.
  172.         SetFaceGeoMode(top0,4);
  173.         SetFaceGeoMode(top1,4);
  174.         SetSectorLight(crack, veclight, 2);
  175.         SetSectorFlags(crack, 0x2);
  176.         SectorSound(crack, gurgle, 1);
  177.     }
  178.     else if (GetCurFrame(watersurface) == 1)
  179.     {
  180.         MoveToFrame(watersurface, 2, 2.0);
  181.         #Print("moving watersurface to 2nd frame");
  182.     }
  183. }
  184. else if (sender == target0)
  185. {
  186.     if (GetCurFrame(target0) != 1) return;
  187.  
  188.     #Print("moving camera and targets");
  189.     Sleep(1.0);
  190.     MoveToFrame(camera0, 1, 0.75);
  191.     MoveToFrame(target0, 2, 1.7);
  192.     SetCameraFOV(90, 1, 3.0);
  193. }
  194. return;
  195.     
  196. #............................................................................
  197. entered:
  198.  
  199. sender = GetSenderRef();
  200. source = GetSourceRef();
  201.  
  202. if (sender == readyToPush)
  203. {
  204.     ClearAdjoinFlags(bldrPlatform, 0x2);
  205. }
  206. else if (sender == moveSurf) #Indy is pushing the rock.
  207. {
  208.     if (source != player) return;
  209.  
  210.     StartCutscene(1);
  211.     curCam = GetCurrentCamera();
  212.     SetCameraFocus(2, camera0);
  213.     SetCameraSecondaryFocus(2, target0);
  214.     MoveToFrame(target0, 1, 0.4);
  215.     SetCurrentCamera(2);
  216.     SetCameraFOV(55, 1, 3.5);
  217. }
  218. else if (sender == teeter) # Rock crosses adjoin, gets shoved out over water, and falls into place.
  219. {
  220.     if (source != rock) return;
  221.  
  222.     PlaySoundLocal(floodMus, 1.0, 0.0, 0x0, 0);
  223.  
  224.     MoveToFrame(rock, 1, 3.0);
  225.     WaitForStop(rock);
  226.     AttachThingToThing(rock, rotateThing0);
  227.     Rotate(rotateThing0, 80.0, 0, 0.35);
  228.     WaitForStop(rotateThing0);
  229.     DetachThing(rock);
  230.  
  231.     PlaySoundThing(splashSnd, rock, 1, -1,-1, 0x0);
  232.  
  233.     splash0 = CreateThing(splashSprTpl0, splashGhost0);
  234.     AnimateSpriteSize(splash0, '0.05 0.05 1.0', '0.5 0.5 0.0', 1.0);
  235.     MaterialAnim(splashMat, 16, 0x0);
  236.  
  237.     splash1 = CreateThing(splashTpl, splashGhost0);
  238.     MaterialAnim(spraymat, 16, 0x8);
  239.     SetLifeLeft(Splash0, 1.5);
  240.     SetLifeLeft(splash1, 0.5);
  241.  
  242.     MoveToFrame(rock, 2, 3.0);
  243.     Sleep(0.5);
  244. }
  245. else if (source == ghostpoint)
  246. {
  247.     if (sender == watersector0)
  248.     {
  249.         SetSectorLight(teeter, veclight, 2);
  250.         SetSectorFlags(teeter, 0x2);
  251.         SectorSound(teeter, gurgle, 1);
  252.         SetSectorLight(teeter2, veclight, 2);
  253.         SetSectorFlags(teeter2, 0x2);
  254.         SectorSound(teeter2, gurgle, 1);
  255.         SetSectorLight(othersector0, veclight, 2);
  256.         SetSectorFlags(othersector0, 0x2);
  257.         SectorSound(othersector0, gurgle, 1);
  258.     }
  259.     else if (sender == watersector1)
  260.     {
  261.         StopSound(rise0, 0.5);
  262.         rise1 = PlaySoundThing(risingSnd1, watersurface, 1, -1,-1, 1);
  263.         SetSectorLight(othersector1, veclight, 2);
  264.         SetSectorFlags(othersector1, 0x2);
  265.         SectorSound(othersector1, gurgle, 1);
  266.         SetSectorLight(othersector2, veclight, 2);
  267.         SetSectorFlags(othersector2, 0x2);
  268.         SectorSound(othersector2, gurgle, 1);
  269.         SetThingFlags(player, 0x80000);
  270.         SetActorFlags(player, 0x200000);
  271.     }
  272.     else if (sender == watersector4)
  273.     {
  274.         SetSectorLight(treasureSector, veclight, 2);
  275.         SetSectorFlags(treasureSector, 0x2);
  276.         SectorSound(treasureSector, gurgle, 1);
  277.         SetCurrentCamera(curCam);
  278.         ClearThingFlags(player, 0x80000);
  279.         ClearActorFlags(player, 0x200000);
  280.         SendMessage(hint, user2);
  281.         EndCutscene();
  282.     }
  283.     else if (sender == watersector7)
  284.     {
  285.         Sleep(3.0);
  286.         ThingFadeAnim(watersurface, 1.0, 0.0, 3.0, 0);
  287.         StopSound(rise1, 0.5);
  288.         Sleep(3.0);
  289.         PlaySoundThing(streamSnd, root, .75, -1,-1, 1);
  290.         DestroyThing(ghostpoint);
  291.         DestroyThing(watersurface);
  292.     }
  293.  
  294.     SetSectorLight(watersector0[index], veclight, 2);
  295.     SetSectorFlags(watersector0[index], 0x2);
  296.     SectorSound(watersector0[index], gurgle, 1);
  297.     index =  index + 1;
  298. }
  299. return;
  300. #............................................................................
  301. exited:
  302.  
  303. if (GetSenderRef() == ReadytoPush)
  304. {
  305.     SetAdjoinFlags(bldrPlatform, 0x2);
  306. }
  307. return;
  308. #............................................................................
  309.  
  310. end
  311.